<%--03_outCollection.jsp--%>
<%@ page import="com.ylaihui.bean.Person" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.HashMap" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>03_outCollection</title>
</head>
<body>
<%
    Person person = new Person();
    person.setName("ylaihui");
    person.setPhones(new String[]{"021-122122","021-122123","021-122124"});

    ArrayList<String> cities = new ArrayList<>();
    cities.add("beijing");
    cities.add("shagnhai");
    cities.add("shenzhen");
    person.setCities(cities);

    HashMap<String, Object> map = new HashMap<>();
    map.put("key1","value1");
    map.put("key2","value2");
    map.put("key3","value3");
    person.setMap(map);

    pageContext.setAttribute("p", person);
%>
    输出Person：${ p }<br/>
    输出Person的name属性：${p.name} <br>
    输出Person的pnones数组属性值：${p.phones[2]} <br>
    输出Person的cities集合中的元素值：${p.cities} <br>
    输出Person的List集合中个别元素值：${p.cities[2]} <br>
    输出Person的Map集合: ${p.map} <br>
    输出Person的Map集合中某个key的值: ${p.map.key3} <br>
    <%--  这里实际上是调用 p 的 getAge 方法，并不是直接读取的 age属性  --%>
    输出Person的age属性：${p.age} <br>

</body>
</html>
